<template>
	<view>
		<view class="house u-radius-5 u-font-28 u-p-18" v-for="i in snlist">
			<view class="flex-between">
				<view class="flex-center">
					<image src="../../static/zxcimg/dy.png" class="w36 h36 u-shrink-no u-m-r-16" mode=""></image>
					<text>{{i.addr1}}</text>
				</view>
				<view class="role u-radius-5 u-shrink-no">
					{{i.role_name}}
				</view>
			</view>
			<view class="u-m-t-16 flex-between">
				<view class="flex-center">
					<image src="../../static/zxcimg/mph.png" class="w36 u-shrink-no h36 u-m-r-16" mode=""></image>
					<text>{{i.room_name}}</text>
					<text class="u-m-l-10">{{i.access_name}}</text>
		
				</view>
			</view>
			<view class="flex-between" v-if="i.is_show_sn">
				<view class=" ">
					sn:{{i.sn}}
				</view>
				<view class="u-shrink-no flex">
					<button class="" size="mini" @click="tovideo(i.sn)" v-if="i.status==0">
						去查看
					</button>
					<view class="" v-else>
						已订阅
					</view>
				</view>
			</view>
			<view class="" style="float: right; " v-else>
				<button class="" size="mini" @click="tovideo(i.sn)" v-if="i.status==0">
					去查看
				</button>
				<view class="" v-else>
					已订阅
				</view>
			</view>
		
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				snlist: [],
			};
		},
		onLoad() {
			this.getsnlist()
		},
		methods:{
			tovideo(sn){
				uni.navigateTo({
					url:'/pages/videopage/videopage?sn=' + sn
				})
			},
			//获得sn列表
			getsnlist() {
				this.$api.get('/passport/getSnList').then(res => {
					this.snlist = res.data
				})
			},
		}
	}
</script>

<style lang="scss">
.house {
		width: 710rpx;
		margin: 30rpx auto;
		background-color: #fff;
		box-sizing: border-box;

		.role {
			background-color: #E2F2FF;
			padding: 2px 4px;
			color: #409EFF;
		}
	}
</style>
